package com.ruoyi.project.agv.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.project.agv.domain.AgvCallback;
import com.ruoyi.project.agv.mapper.AgvCallbackMapper;
import com.ruoyi.project.agv.service.IAgvCallbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * AgvCallbackService业务层处理
 *
 * @author wz
 * @date 2022-03-12
 */
@Service
public class AgvCallbackServiceImpl implements IAgvCallbackService
{
    @Autowired
    private AgvCallbackMapper agvCallbackMapper;

    /**
     * 查询AgvCallback
     *
     * @param reqCode AgvCallbackID
     * @return AgvCallback
     */
    @Override
    public AgvCallback selectAgvCallbackById(String reqCode)
    {
        return agvCallbackMapper.selectAgvCallbackById(reqCode);
    }

    /**
     * 查询AgvCallback列表
     *
     * @param agvCallback AgvCallback
     * @return AgvCallback
     */
    @Override
    public List<AgvCallback> selectAgvCallbackList(AgvCallback agvCallback)
    {
        return agvCallbackMapper.selectAgvCallbackList(agvCallback);
    }

    /**
     * 新增AgvCallback
     *
     * @param agvCallback AgvCallback
     * @return 结果
     */
    @Override
    public int insertAgvCallback(AgvCallback agvCallback)
    {
        return agvCallbackMapper.insertAgvCallback(agvCallback);
    }

    /**
     * 修改AgvCallback
     *
     * @param agvCallback AgvCallback
     * @return 结果
     */
    @Override
    public int updateAgvCallback(AgvCallback agvCallback)
    {
        return agvCallbackMapper.updateAgvCallback(agvCallback);
    }

    /**
     * 删除AgvCallback对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAgvCallbackByIds(String ids)
    {
        return agvCallbackMapper.deleteAgvCallbackByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除AgvCallback信息
     *
     * @param reqCode AgvCallbackID
     * @return 结果
     */
    @Override
    public int deleteAgvCallbackById(String reqCode)
    {
        return agvCallbackMapper.deleteAgvCallbackById(reqCode);
    }

    public Map<String, String> impJob(String taskNo){
        Map<String, String> map = new HashMap();
        map.put("v_task_no", taskNo);
        map.put("v_result", null);
        agvCallbackMapper.impJob(map);
        return map;
    }

    @Override
    public Map<String, String> impAgvStart(String reqCode) {
        Map<String, String> map = new HashMap();
        map.put("v_req_code", reqCode);
        map.put("v_result", null);
        map.put("v_result_msg", null);
        agvCallbackMapper.impAgvStart(map);
        return map;
    }

    @Override
    public Map<String, String> impAgvOutBin(String reqCode) {
        Map<String, String> map = new HashMap();
        map.put("v_req_code", reqCode);
        map.put("v_result", null);
        map.put("v_result_msg", null);
        agvCallbackMapper.impAgvOutBin(map);
        return map;
    }

    @Override
    public Map<String, String> impAgvEnd(String reqCode) {
        Map<String, String> map = new HashMap();
        map.put("v_req_code", reqCode);
        map.put("v_result", null);
        map.put("v_result_msg", null);
        agvCallbackMapper.impAgvEnd(map);
        return map;
    }

    @Override
    public Map<String, String> impAgvApply(String reqCode) {
        Map<String, String> map = new HashMap();
        map.put("v_req_code", reqCode);
        map.put("v_result", null);
        map.put("v_result_msg", null);
        agvCallbackMapper.impAgvApply(map);
        return map;
    }
}
